using NUnit.Framework;
using TDUnit.TestDataParsers.XmlParser;

namespace TDUnit.Tests
{
    [TestFixture]
    public class ImportElementProcessorTests : XmlTestDataParserBase
    {
        #region Handle Import elements tests

        [Test]
        [ExpectedException(typeof(XmlTestDataParserException))]
        public void ImportElementWithNoFileAttributeThrowsException()
        {
            const string testData = "<TestData><Import /></TestData>";
            Parse(testData);
        }

        [Test]
        public void ImportElementInTestDataCausesFileToBeImported()
        {
            const string testData = "<TestData><Import File='TestImportFile.xml'/></TestData>";
            var td = Parse(testData);

            Assert.IsNotNull(td.GetTable("TestImportTable").Rows[0]);
        }

        #endregion
    }
}